/*******************************************************************************
*  Project      : Minigate Golfin                                 
*  Program ID   : my_home.js                            
*  Description  : 마이홈
*
********************************************************************************
*  Program History                                                            
*  Date        Author    Description                                          
*  ----------  --------  -------------------------------------------------------- 
*  2012-06-25  김효순    Created.  
*******************************************************************************/

jQuery(function($){
	// 나의 스코어
	function clsMyScore()
	{
		this._HTMLDom = null;
		this.infoData = null;
	}
	
	clsMyScore.prototype = {
		setInfo: function(val){
			this.infoData = val;
			this.display();
		}
		, display: function(){
			var $layer = this._HTMLDom["$layer"];
			
			$layer.find("em:last").html(document.objUtil.nvl(this.infoData["스코어"], 0));
		}
	}
	
	// 평균스코어
	function clsAvgScore()
	{
		this.ssuper = null;
		
		this._init();
	}
	
	clsAvgScore.prototype = new clsMyScore();
	clsAvgScore.prototype._init = function(){
		var $layer = $("div#container section#my_score>div.my_h_score>dl:eq(0)");
		this._HTMLDom = {
			"$layer": $layer
		}
		this.ssuper = clsMyScore.prototype;
		
		this.setInfo({
			"스코어": 0
		});
	}
	
	// 베스트 스코어
	function clsBestScore()
	{
		this.ssuper = null;
		
		this._init();
	}
	
	clsBestScore.prototype = new clsMyScore();
	clsBestScore.prototype._init = function(){
		var $layer = $("div#container section#my_score>div.my_h_score>dl:eq(1)");
		this._HTMLDom = {
			"$layer": $layer
		}
		this.ssuper = clsMyScore.prototype;
		
		this.setInfo({
			"스코어": 0
		});
	}
	clsBestScore.prototype.display =function(){
		var $layer = this._HTMLDom["$layer"];
		this.ssuper.display.apply(this, arguments);
		
		$layer.find("li:eq(0)>strong").html(document.objUtil.nvl(this.infoData["골프장명"]));
		$layer.find("li:eq(1)").html(document.objUtil.nvl(this.infoData["코스명"]));
	}
	
	// 최대타수
	function clsWorstScore()
	{
		this.ssuper = null;
		
		this._init();
	}
	
	clsWorstScore.prototype = new clsMyScore();
	clsWorstScore.prototype._init = function(){
		var $layer = $("div#container section#my_score>div.my_h_score>dl:eq(2)");
		this._HTMLDom = {
			"$layer": $layer
		}
		this.ssuper = clsMyScore.prototype;
		
		this.setInfo({
			"스코어": 0
		});
	}
	clsWorstScore.prototype.display = clsBestScore.prototype.display;
	
	// 알림 일반
	function clsAlarmCommon()
	{
		this._HTMLDom = null;
		this.infoData = null;
	}
	
	clsAlarmCommon.prototype = {
		setInfo: clsMyScore.prototype.setInfo
		, display: function(){
			var $layer = this._HTMLDom["$layer"];
			
			$layer.find("dd").html(this.infoData["미확인"] + "<em>/ " + this.infoData["전체"]);
		}
	}
	
	// 부킹/조인 알림
	function clsBookingJoinAlarm()
	{
		this.ssuper = null;
		this._init();
	}
	
	clsBookingJoinAlarm.prototype = new clsAlarmCommon();
	clsBookingJoinAlarm.prototype._init = function(){
		var $layer = $("div#container>div.group>section#my_home_left>div.my_h_list:eq(0)>dl:eq(0)");
		this._HTMLDom = {
			"$layer": $layer
		}
		this.ssuper = clsAlarmCommon.prototype;
		
		this.setInfo({
			"미확인": 0
			, "전체": 0
		});
	}
	
	
	// 마일리지 일반
	function clsMileageCommon()
	{
		this._HTMLDom = null;
		this.infoData = null;
	}
	
	clsMileageCommon.prototype = {
		setInfo: clsMyScore.prototype.setInfo
		, display: function(){
			var $layer = this._HTMLDom["$layer"];
			
			$layer.find("dd").html(this.infoData["값"]);
		}
	}
	
	// 보유마일리지
	function clsMyMileage()
	{
		this.ssuper = null;
		this._init();
	}
	
	clsMyMileage.prototype = new clsMileageCommon();
	clsMyMileage.prototype._init = function(){
		var $layer = $("div#container>div.group>section#my_home_right>div.my_h_list:eq(0)>dl:eq(0)");
		this._HTMLDom = {
			"$layer": $layer
		}
		this.ssuper = clsMileageCommon.prototype;
		
		this.setInfo({
			"값": 0
		});
	}
	
	// 최근 한달간 예약횟수 -> 결제완료건
	function clsReserveCount()
	{
		this.ssuper = null;
		this._init();
	}
	
	clsReserveCount.prototype = new clsMileageCommon();
	clsReserveCount.prototype._init = function(){
		var $layer = $("div#container>div.group>section#my_home_right>div.my_h_list:eq(0)>dl:eq(1)");
		this._HTMLDom = {
			"$layer": $layer
		}
		this.ssuper = clsMileageCommon.prototype;
		
		this.setInfo({
			"값": 0
		});
	}
	
	// 최근 한달간 라운딩수 -> 결제 취소건
	function clsRoundingCount()
	{
		this.ssuper = null;
		this._init();
	}
	
	clsRoundingCount.prototype = new clsMileageCommon();
	clsRoundingCount.prototype._init = function(){
		var $layer = $("div#container>div.group>section#my_home_right>div.my_h_list:eq(0)>dl:eq(2)");
		this._HTMLDom = {
			"$layer": $layer
		}
		this.ssuper = clsMileageCommon.prototype;
		
		this.setInfo({
			"값": 0
		});
	}
	
	// 부킹정보 예약확정
	function clsBookingReserveConfirm()
	{
		this.ssuper = null;
		this._init();
	}
	
	clsBookingReserveConfirm.prototype = new clsMileageCommon();
	clsBookingReserveConfirm.prototype._init = function(){
		var $layer = $("div#container>div.group>section#my_home_left>div.my_h_list:eq(1)>dl:eq(0)");
		this._HTMLDom = {
			"$layer": $layer
		}
		this.ssuper = clsMileageCommon.prototype;
		
		this.setInfo({
			"값": 0
		});
	}
	
	// 부킹정보 보증결제대기
	function clsBookingPaymentWait()
	{
		this.ssuper = null;
		this._init();
	}
	
	clsBookingPaymentWait.prototype = new clsMileageCommon();
	clsBookingPaymentWait.prototype._init = function(){
		var $layer = $("div#container>div.group>section#my_home_left>div.my_h_list:eq(1)>dl:eq(1)");
		this._HTMLDom = {
			"$layer": $layer
		}
		this.ssuper = clsMileageCommon.prototype;
		
		this.setInfo({
			"값": 0
		});
	}
	
	
	// 부킹 웨이팅
	function clsBookingWaiting()
	{
		this.ssuper = null;
		this._init();
	}
	
	clsBookingWaiting.prototype = new clsMileageCommon();
	clsBookingWaiting.prototype._init = function(){
		var $layer = $("div#container>div.group>section#my_home_left>div.my_h_list:eq(1)>dl:eq(2)");
		this._HTMLDom = {
			"$layer": $layer
		}
		this.ssuper = clsMileageCommon.prototype;
		
		this.setInfo({
			"값": 0
		});
	}
	
	// 조인 참여신청
	function clsJoinroomApply()
	{
		this.ssuper = null;
		this._init();
	}
	
	clsJoinroomApply.prototype = new clsMileageCommon();
	clsJoinroomApply.prototype._init = function(){
		var $layer = $("div#container>div.group>section#my_home_right>div.my_h_list:eq(1)>dl:eq(0)");
		this._HTMLDom = {
			"$layer": $layer
		}
		this.ssuper = clsMileageCommon.prototype;
		
		this.setInfo({
			"값": 0
		});
	}
	
	// 조인정보 참여확정
	function clsJoinroomJoin()
	{
		this.ssuper = null;
		this._init();
	}
	
	clsJoinroomJoin.prototype = new clsMileageCommon();
	clsJoinroomJoin.prototype._init = function(){
		var $layer = $("div#container>div.group>section#my_home_right>div.my_h_list:eq(1)>dl:eq(1)");
		this._HTMLDom = {
			"$layer": $layer
		}
		this.ssuper = clsMileageCommon.prototype;
		
		this.setInfo({
			"값": 0
		});
	}
	
	// 내가만든 조인룸
	function clsJoinroom()
	{
		this.ssuper = null;
		this._init();
	}
	
	clsJoinroom.prototype = new clsMileageCommon();
	clsJoinroom.prototype._init = function(){
		var $layer = $("div#container>div.group>section#my_home_right>div.my_h_list:eq(1)>dl:eq(2)");
		this._HTMLDom = {
			"$layer": $layer
		}
		this.ssuper = clsMileageCommon.prototype;
		
		this.setInfo({
			"값": 0
		});
	}
	
	// 나의 정보
	function clsMyExtraList()
	{
		this._HTMLDom = null;
		this.infoData = null;
		
		this._init();
	}
	
	clsMyExtraList.prototype = {
		_init: function(){
			var $layer = $("div#container section#my_infolist")
			this._HTMLDom = {
				"$layer": $layer
				, "$element": $layer.find("ul.my_h_my>li:first").clone(true)
			}
			this.setInfo({});
		}
		, $getLayer: function(){
			return this._HTMLDom["$layer"];
		}
		, setInfo: function(thisData){
			this.infoData = thisData;
			this.display();
		}
		, display: function(){
			var $layer = this.$getLayer();
			var $element = this._HTMLDom["$element"];
			var thisClass = this;
			
			var w = {
				"web": "PC"
				, "mobile": "모바일"
			}
			
			$layer.find("ul.my_h_my").empty();
			
			if(this.infoData["로그인정보"]){
				$layer.find("ul.my_h_my").append($element.clone(true));
				$layer.find("ul.my_h_my li:last").html("<strong>이전 로그인 일시</strong> : " + this.infoData["로그인정보"]["날짜"]+ " " + this.infoData["로그인정보"]["시간"] + " " + w[this.infoData["로그인정보"]["플랫폼"]]+ "로그인");
			}
			
			if(this.infoData["모바일여부"] == "Y"){
				$layer.find("ul.my_h_my").append($element.clone(true));
				$layer.find("ul.my_h_my li:last").html("고객님께서는 골프인 모바일 앱 설치 고객입니다.");
			}
			
			if(this.infoData["비밀번호여부"] == "Y"){
				$layer.find("ul.my_h_my").append($element.clone(true));
				$layer.find("ul.my_h_my li:last").html("최근 6개월간 비밀번호를 변경하시지 않았습니다.  개인 보안을 위하여 <strong>비밀번호를 변경</strong>하여 주세요.");
			}
		}
		, spinStart: function(){
			var $layer = this.$getLayer();
			
			$layer.find("ul.my_h_my").hide();
			if($layer.find("div#tmpSpin").length == 0){
				$layer.append("<div id='tmpSpin' style='position:relative; width: 1000px; height: 100px;' />");
			}
			$layer.find("div#tmpSpin").show().spin();
		}
		, spinEnd: function(){
			var $layer = this.$getLayer();
			
			$layer.find("div#tmpSpin").hide().spin(false);
			$layer.find("ul.my_h_my").show();
		}
	}
	
	
	// 서버통신
	function clsComm()
	{
		this._init();
	}
	
	clsComm.prototype = {
		_init: function(){
			
		}
		// 평균 스코어
		, getAvgScore: function(){
			var thisClass = this;
			
			//ajax
			var serviceName = "getMyAverageScore";
			document.objGlobal.ajax({
				"sid": "US001"
				, "servicename": serviceName
			}, {
				
			}, function(ret){
				var res = {
					"결과코드": ret["msp"]["contents"]["serviceResult"]
					, "메시지": document.objGlobal.getResultMsg(ret)
					, "결과값": {}
				}
				
				var items = ret["msp"]["contents"]["items"];
				if(items) res["결과값"] = {
					"스코어": _util.nvl(items, 0)
				}
				
				document.objControl.finishAvgScore(res);
			});
		}
		//베스트 스코어
		, getBestScore: function(){
			var thisClass = this;
			
			//ajax
			var serviceName = "getMyBestScore";
			document.objGlobal.ajax({
				"sid": "US001"
				, "servicename": serviceName
			}, {
				
			}, function(ret){
				var res = {
					"결과코드": ret["msp"]["contents"]["serviceResult"]
					, "메시지": document.objGlobal.getResultMsg(ret)
					, "결과값": {}
				}
				
				var items = ret["msp"]["contents"]["items"];
				if(items){
					res["결과값"] = {
						"골프장명": _util.nvl(items["golfclubName"])
						, "코스명": _util.nvl(items["courseInfoName"])
						, "스코어": _util.nvl(items["score"], 0)
					}
				}
				
				document.objControl.finishBestScore(res);
			});
		}
		//최대타수
		, getWorstScore: function(){
			var thisClass = this;
			
			//ajax
			var serviceName = "getMyWorstScore";
			document.objGlobal.ajax({
				"sid": "US001"
				, "servicename": serviceName
			}, {
				
			}, function(ret){
				var res = {
					"결과코드": ret["msp"]["contents"]["serviceResult"]
					, "메시지": document.objGlobal.getResultMsg(ret)
					, "결과값": {}
				}
				
				var items = ret["msp"]["contents"]["items"];
				if(items){
					res["결과값"] = {
						"골프장명": _util.nvl(items["golfclubName"])
						, "코스명": _util.nvl(items["courseInfoName"])
						, "스코어": _util.nvl(items["score"], 0)
					}
				}
				
				document.objControl.finishWorstScore(res);
			});
		}
		// 부킹/조인알림
		, getBookingJoinAlarm: function(){
			var thisClass = this;
			
			//ajax
			var serviceName = "";
			setTimeout(function(){
				var rnd = document.objUtil.random(0, 50);
				var rnd1 = document.objUtil.random(0, rnd);
				
				var res = {
					"결과코드": "00000"
					, "메시지": ""
					, "결과값": {}
				}
				
				res["결과값"] = {
					"새알림": rnd1
					, "전체알림": rnd
				}
				
				document.objControl.finishBookingJoinAlarm(res);
			}, 1000);
		}
		// 동호회 알림
		, getClubAlarm: function(){
			var thisClass = this;
			
			//ajax
			var serviceName = "";
			setTimeout(function(){
				var rnd = document.objUtil.random(0, 50);
				var rnd1 = document.objUtil.random(0, rnd);
				
				var res = {
					"결과코드": "00000"
					, "메시지": ""
					, "결과값": {}
				}
				
				res["결과값"] = {
					"새알림": rnd1
					, "전체알림": rnd
				}
				
				document.objControl.finishClubAlarm(res);
			}, 1000);
		}
		// 쪽지
		, getMessageAlarm: function(){
			var thisClass = this;
			
			//ajax
			var serviceName = "";
			setTimeout(function(){
				var rnd = document.objUtil.random(0, 50);
				var rnd1 = document.objUtil.random(0, rnd);
				
				var res = {
					"결과코드": "00000"
					, "메시지":""
					, "결과값": {}
				}
				
				res["결과값"] = {
					"새알림": rnd1
					, "전체알림": rnd
				}
				
				document.objControl.finishMessageAlarm(res);
			}, 1000);
		}
		// 보유마일리지
		, getMyMileage: function(){
			var thisClass = this;
			
			//ajax
			var serviceName = "getMyPoint";
			document.objGlobal.ajax({
				"sid": "US001"
				, "servicename": serviceName
			}, {
				
			}, function(ret){
				var res = {
					"결과코드": ret["msp"]["contents"]["serviceResult"]
					, "메시지": document.objGlobal.getResultMsg(ret)
					, "결과값": {}
				}
				
				var items = ret["msp"]["contents"]["items"];
				if(items){
					res["결과값"] = {
						"값": items
					}
				}
				
				document.objControl.finishMyMileage(res);
			});
		}
		// 최근 한달간 예약횟수 -> 결제 완료
		, getReserveCount: function(){
			var thisClass = this;
			
			//ajax
			var serviceName = "getMyBookingMPcnt";
			document.objGlobal.ajax({
				"sid": "US001"
				, "servicename": serviceName
			}, {
				
			}, function(ret){
				var res = {
					"결과코드": ret["msp"]["contents"]["serviceResult"]
					, "메시지": document.objGlobal.getResultMsg(ret)
					, "결과값": {}
				}
				
				var items = ret["msp"]["contents"]["items"];
				if(items){
					res["결과값"] = {
						"값": items
					}
				}
				
				document.objControl.finishReserveCount(res);
			});
		}
		// 최근 한달간 라운딩스 -> 결제 취소
		, getRoundingCount: function(){
			var thisClass = this;
			
			//ajax
			var serviceName = "getMyBookingMAcnt";
			document.objGlobal.ajax({
				"sid": "US001"
				, "servicename": serviceName
			}, {
				
			}, function(ret){
				var res = {
					"결과코드": ret["msp"]["contents"]["serviceResult"]
					, "메시지": document.objGlobal.getResultMsg(ret)
					, "결과값": {}
				}
				
				var items = ret["msp"]["contents"]["items"];
				if(items){
					res["결과값"] = {
						"값": items
					}
				}
				
				document.objControl.finishRoundingCount(res);
			});
		}
		// 예약확정
		, getBookingReserveConfirm: function(){
			var thisClass = this;
			
			//ajax
			var serviceName = "getMyBookingAcnt";
			var options = {
				
			}
			_gf.ajax({
				"sid": "US001"
				, "servicename": serviceName
			}, options, function(ret){
				var res = {
					"결과코드": ret["msp"]["contents"]["serviceResult"]
					, "메시지": document.objGlobal.getResultMsg(ret)
					, "결과값": {}
				}
				
				var items = ret["msp"]["contents"]["items"];
				if(items){
					res["결과값"] ={
						"값": items
					}
				}
				
				document.objControl.finishBookingReserveConfirm(res);
			});
			var serviceName = "";
		}
		// 보증결제대기
		, getBookingPaymentWait: function(){
			var thisClass = this;
			
			//ajax
			var serviceName = "getMyBookingGcnt";
			var options = {
				
			}
			_gf.ajax({
				"sid": "US001"
				, "servicename": serviceName
			}, options, function(ret){
				var res = {
					"결과코드": ret["msp"]["contents"]["serviceResult"]
					, "메시지": document.objGlobal.getResultMsg(ret)
					, "결과값": {}
				}
				
				var items = ret["msp"]["contents"]["items"];
				if(items){
					res["결과값"] ={
						"값": items
					}
				}
				
				document.objControl.finishBookingPaymentWait(res);
			});
		}
		// 부킹 웨이팅
		, getBookingWaiting: function(){
			var thisClass = this;
			
			//ajax
			var serviceName = "getMyWaitingCnt";
			var options = {
				
			}
			_gf.ajax({
				"sid": "US001"
				, "servicename": serviceName
			}, options, function(ret){
				var res = {
					"결과코드": ret["msp"]["contents"]["serviceResult"]
					, "메시지": document.objGlobal.getResultMsg(ret)
					, "결과값": {}
				}
				
				var items = ret["msp"]["contents"]["items"];
				if(items){
					res["결과값"] ={
						"값": items
					}
				}
				
				document.objControl.finishBookingWaiting(res);
			});
		}
		// 참여신청
		, getJoinroomApply: function(){
			var thisClass = this;
			
			//ajax
			var serviceName = "getMyJoinroomAsk";
			var options = {
				
			}
			_gf.ajax({
				"sid": "US001"
				, "servicename": serviceName
			}, options, function(ret){
				var res = {
					"결과코드": ret["msp"]["contents"]["serviceResult"]
					, "메시지": document.objGlobal.getResultMsg(ret)
					, "결과값": {}
				}
				
				var items = ret["msp"]["contents"]["items"];
				if(items){
					res["결과값"] ={
						"값": items
					}
				}
				
				document.objControl.finishJoinroomApply(res);
			});
		}
		// 참여확정
		, getJoinroomJoin: function(){
			var thisClass = this;
			
			//ajax
			var serviceName = "getMyJoinroomAskOk";
			var options = {
				
			}
			_gf.ajax({
				"sid": "US001"
				, "servicename": serviceName
			}, options, function(ret){
				var res = {
					"결과코드": ret["msp"]["contents"]["serviceResult"]
					, "메시지": document.objGlobal.getResultMsg(ret)
					, "결과값": {}
				}
				
				var items = ret["msp"]["contents"]["items"];
				if(items){
					res["결과값"] = {
						"값": items
					}
				}
				
				document.objControl.finishJoinroomJoin(res);
			});
		}
		// 내가만든 조인룸
		, getJoinroom: function(){
			var thisClass = this;
			
			//ajax
			var serviceName = "getMyJoinroomCnt";
			var options = {
				
			}
			_gf.ajax({
				"sid": "US001"
				, "servicename": serviceName
			}, options, function(ret){
				var res = {
					"결과코드": ret["msp"]["contents"]["serviceResult"]
					, "메시지": document.objGlobal.getResultMsg(ret)
					, "결과값": {}
				}
				
				var items = ret["msp"]["contents"]["items"];
				if(items){
					res["결과값"] = {
						"값": items
					}
				}
				
				document.objControl.finishJoinroom(res);
			});			
		}
		// 나의정보
		, getMyExtraList: function(arg){
			var thisClass = this;
			
			arg = arg || {}
			arg["콜백"] = arg["콜백"] || function(){}
			
			//ajax
			var serviceName = "getMyGolfinUserInfo";
			var options = {
				
			}
			_gf.ajax({
				"sid": "US001"
				, "servicename": serviceName
			}, options, function(ret){
				var res = {
					"결과코드": ret["msp"]["contents"]["serviceResult"]
					, "메시지": _gf.getResultMsg(ret)
					, "결과값": {}
				}
				
				var items = ret["msp"]["contents"]["items"];
				var obj = items;
				var loginDate = _util.nvl(obj["loginHistory"]["loginDate"])+"";
				var loginTime = _util.nvl(obj["loginHistory"]["loginTime"])+"";
				
				res["결과값"] = {
					"모바일여부": _util.nvl(obj["mobileAppYn"])
					, "비밀번호여부": _util.nvl(obj["pwdExpiredYn"])
					, "로그인정보": {
						"플랫폼": _util.nvl(obj["loginHistory"]["osType"])
						, "날짜": loginDate.substrEx(0, 4) + ". " + loginDate.substrEx(4, 2) + ". " + loginDate.substrEx(6, 2)
						, "시간": loginDate.substrEx(0, 2) + ":" + loginDate.substrEx(2, 2)
					}
				};
				
				arg["콜백"].apply(null, [res]);
			});
		}
	}
	
	// 컨트롤
	function clsControl()
	{
		this.objComm = null;
		this.objAvgScore = null;
		this.objBestScore = null;
		this.objWorstScore = null;
		this.objMyMileage = null;
		this.objReserveCount = null;
		this.objRoundingCount = null;
		this.objBookingReserveConfirm = null;
		this.objBookingPaymentWait = null;
		this.objBookingWaiting = null;
		this.objJoinroomApply = null;
		this.objJoinroomJoin = null;
		this.objJoinroom = null;
		this.objMyExtraList = null;
		
		this._permitStart = null;
	}
	
	clsControl.prototype = {
		_init: function(){
			this._preload();
			
			this.objComm = new clsComm();
			this.objAvgScore = new clsAvgScore();
			this.objBestScore = new clsBestScore();
			this.objWorstScore = new clsWorstScore();
			this.objMyMileage = new clsMyMileage();
			this.objReserveCount = new clsReserveCount();
			this.objRoundingCount = new clsRoundingCount();
			this.objBookingReserveConfirm = new clsBookingReserveConfirm();
			this.objBookingPaymentWait = new clsBookingPaymentWait();
			this.objBookingWaiting = new clsBookingWaiting();
			this.objJoinroomApply = new clsJoinroomApply();
			this.objJoinroomJoin = new clsJoinroomJoin();
			this.objJoinroom = new clsJoinroom();
			this.objMyExtraList = new clsMyExtraList();
			
			this._beforeStart();
			this._bind();
		}
		, _preload: function(){
			_gf.spinStart();
		}
		, _beforeStart: function(){
			var thisClass = this;
			this._permitStart = {
				
			}
			
			$.ajax({
				url: _ROOT + "/js/mypage_common.js"
				, dataType: "script"
				, async: false
				, success: function(){
					
				}
				, error: function(){
					alert("error");
				}
			});
			
			_util.executeThread(function(){
				for(var k in thisClass._beforeStart){
					if(!thisClass._beforeStart[k]) return false;
				}
				
				return (_gf.getMyInfoData());
			}, function(){
				_gf.spinEnd();
				thisClass._start();
			});
		}
		, _bind: function(){
			var thisClass = this;
			
			// 개인정보 변경하기
			this.objMyExtraList.$getLayer().on("click", "img[alt='개인정보 변경하기']", function(){
				thisClass.goMyInfoWritePage();
			});
			
			$(document).on("click", "img[alt='스코어 입력'], img[alt='more']", function(){
				var bName = $(this).attr("alt");
				
				switch(bName){
					case "스코어 입력":
						thisClass.goScoreWritePage();
						break;
					case "more":
						var n = $("img[alt='more']").index($(this));
						var mList = [
							thisClass.goAlimPage
							, thisClass.goBookingPage
							, thisClass.goMileagePage
							, thisClass.goJoinroomPage
						];
						mList[n].apply(null);
						break;
				}
			});
		}
		, _start: function(){
			var thisClass = this;
			
			// 평균스코어
			this.objComm.getAvgScore();
			// 베스트스코어
			this.objComm.getBestScore();
			// 최대타수
			this.objComm.getWorstScore();
			// 보유 마일리지
			this.objComm.getMyMileage();
			// 최근 한달간 예약횟수
			this.objComm.getReserveCount();
			// 최근 한달간 라운딩수
			this.objComm.getRoundingCount();
			// 부킹정보 예약확정
			this.objComm.getBookingReserveConfirm();
			// 부킹정보 보증결제대기
			this.objComm.getBookingPaymentWait();
			// 부킹 웨이팅
			this.objComm.getBookingWaiting();
			// 조인 참여신청
			this.objComm.getJoinroomApply();
			// 참여확정
			this.objComm.getJoinroomJoin();
			// 내가만든 조인룸
			this.objComm.getJoinroom();
			// 나의 정보
			this.objComm.getMyExtraList({
				"콜백": function(ret){
					thisClass.finishMyExtraList(ret);
				}
			});
		}
		// 평균 스코어 완료
		, finishAvgScore: function(ret){
			if(ret["메시지"]) alert(ret["메시지"]);
			if(ret["결과코드"] != "00000") return;
			
			this.objAvgScore.setInfo(ret["결과값"]);
		}
		// 베스트 스코어 완료
		, finishBestScore: function(ret){
			if(ret["메시지"]) alert(ret["메시지"]);
			if(ret["결과코드"] != "00000") return;
			
			this.objBestScore.setInfo(ret["결과값"]);
		}
		// 최대타수 완료
		, finishWorstScore: function(ret){
			if(ret["메시지"]) alert(ret["메시지"]);
			if(ret["결과코드"] != "00000") return;
			
			this.objWorstScore.setInfo(ret["결과값"]);
		}
		// 마일리지 완료
		, finishMyMileage: function(ret){
			if(ret["메시지"]) alert(ret["메시지"]);
			if(ret["결과코드"] != "00000") return;
			
			this.objMyMileage.setInfo(ret["결과값"]);
		}
		// 최근 한달간 예약횟수 완료
		, finishReserveCount: function(ret){
			if(ret["메시지"]) alert(ret["메시지"]);
			if(ret["결과코드"] != "00000") return;
			
			this.objReserveCount.setInfo(ret["결과값"]);
		}
		// 최근 한달간 라운딩수 완료
		, finishRoundingCount: function(ret){
			if(ret["메시지"]) alert(ret["메시지"]);
			if(ret["결과코드"] != "00000") return;
			
			this.objRoundingCount.setInfo(ret["결과값"]);
		}
		// 예약확정 완료
		, finishBookingReserveConfirm: function(ret){
			if(ret["메시지"]) alert(ret["메시지"]);
			if(ret["결과코드"] != "00000") return;
			
			this.objBookingReserveConfirm.setInfo(ret["결과값"]);
		}
		// 보증결제대기 완료
		, finishBookingPaymentWait: function(ret){
			if(ret["메시지"]) alert(ret["메시지"]);
			if(ret["결과코드"] != "00000") return;
			
			this.objBookingPaymentWait.setInfo(ret["결과값"]);
		}
		// 부킹 웨이팅 완료
		, finishBookingWaiting: function(ret){
			if(ret["메시지"]) alert(ret["메시지"]);
			if(ret["결과코드"] != "00000") return;
			
			this.objBookingWaiting.setInfo(ret["결과값"]);
		}
		// 조인 참여신청 완료
		, finishJoinroomApply: function(ret){
			if(ret["메시지"]) alert(ret["메시지"]);
			if(ret["결과코드"] != "00000") return;
			
			this.objJoinroomApply.setInfo(ret["결과값"]);
		}
		// 참여확정 완료
		, finishJoinroomJoin: function(ret){
			if(ret["메시지"]) alert(ret["메시지"]);
			if(ret["결과코드"] != "00000") return;
			
			this.objJoinroomJoin.setInfo(ret["결과값"]);
		}
		// 나의 정보 완료
		, finishMyExtraList: function(ret){
			if(ret["메시지"]) alert(ret["메시지"]);
			if(ret["결과코드"] != "00000") return;
			
			this.objMyExtraList.spinEnd();
			this.objMyExtraList.setInfo(ret["결과값"]);
		}
		// 내가만든 조인룸
		, finishJoinroom: function(ret){
			if(ret["메시지"]) alert(ret["메시지"]);
			if(ret["결과코드"] != "00000") return;
			
			this.objJoinroom.setInfo(ret["결과값"]);
		}
		// 스코어 입력 이동
		, goScoreWritePage: function(){
			var szLink = _ROOT + "/mypage/my_score_write.html";
			document.location.href = szLink;
		}
		// 개인정보 변경 이동
		, goMyInfoWritePage: function(){
			var szLink = _ROOT + "/mypage/my_privacy.html";
			document.location.href = szLink;
		}
		// 알림 이동
		, goAlimPage: function(){
			var szLink = _ROOT + "/mypage/my_alim.html";
			document.location.href = szLink;
		}
		// 부킹정보 이동
		, goBookingPage: function(){
			var szLink = _ROOT + "/mypage/my_booking.html";
			document.location.href = szLink;
		}
		// 결제 마일리지 이동
		, goMileagePage: function(){
			var szLink = _ROOT + "/mypage/my_mileage.html";
			document.location.href = szLink;
		}
		// 조인정보 이동
		, goJoinroomPage: function(){
			var szLink = _ROOT + "/mypage/my_joinroom.html";
			document.location.href = szLink;
		}
	}
	
	document.objControl = new clsControl();
	document.objControl._init();
});
